﻿/*-------------------------------------------------------------------------
* 命名空间: SiliconSelect.Converter/CheckBoxConverter
* 类       名: CheckBoxConverter
* 功      能:  是否显示CheckBox的转换器,只有是True或者False在字符串中的时候,才会显示.
* 时      间:  2023/7/20 15:46:57
* 版      本:  V1.0
* 作      者:  Fioman
* 格      言:  Talk is cheap,show me the code ^_^
*-------------------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace SiliconSelect.Converter
{
    public class CheckBoxConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is string temp)
            {
                if (temp.ToUpper().Contains("TRUE") || temp.ToUpper().Contains("FALSE"))
                {
                    return "0";
                }
            }
            return "1";
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
